<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'

const router = useRouter()
const customerId = ref('cs001')
const modelType = ref('normal')
const responseType = ref('stream')

// 模型类型选项
const modelTypeOptions = [
  { label: '普通模式', value: 'normal' },
  { label: '深度思考模式', value: 'think' }
]

// 响应类型选项
const responseTypeOptions = [
  { label: '流式响应', value: 'stream' },
  { label: '同步响应', value: 'normal' }
]

const startSimulation = () => {
  if (customerId.value.trim()) {
    router.push({
      path: '/chat',
      query: { 
        customerId: customerId.value,
        modelType: modelType.value,
        responseType: responseType.value
      }
    })
  } else {
    ElMessage.error('请输入客服ID')
  }
}
</script>

<template>
  <div class="login-container">
    <div class="login-box">
      <h1 class="title">AI训练场</h1>
      <div class="banner">
        <img src="../assets/banner.png" alt="训练场横幅" class="banner-img" />
      </div>
      <div class="input-area">
        <el-form>
          <el-form-item>
            <el-input v-model="customerId" placeholder="请输入客服ID" clearable>
              <template #prepend>客服ID</template>
            </el-input>
          </el-form-item>
          
          <el-form-item>
            <el-select v-model="modelType" placeholder="请选择模型类型" style="width: 100%;">
              <el-option
                v-for="item in modelTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          
          <el-form-item>
            <el-select v-model="responseType" placeholder="请选择响应类型" style="width: 100%;">
              <el-option
                v-for="item in responseTypeOptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          
          <el-form-item>
            <el-button type="primary" @click="startSimulation" class="start-btn">模拟开始</el-button>
          </el-form-item>
        </el-form>
      </div>
      <div class="description">
        <h3>精选通用训练预设</h3>
        <div class="scene-list">
          <div class="scene-item">
            <h4>家用厨电售前场景</h4>
            <p>AI顾客将会向您咨询以下产品：抽油烟机、炉灶、洗碗机、冰箱、洗衣机、热水器</p>
            <el-button class="start-btn-sm">开始接待</el-button>
          </div>
          <div class="scene-item">
            <h4>生活电器售前场景</h4>
            <p>AI顾客将会向您咨询以下产品：扫地机、电饭锅、榨汁机、电饭煲、空气炸锅</p>
            <el-button class="start-btn-sm">开始接待</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #f0f2f5;
}

.login-box {
  width: 800px;
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.title {
  text-align: center;
  color: #1e88e5;
  margin-bottom: 20px;
}

.banner {
  margin-bottom: 30px;
  text-align: center;
}

.banner-img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
}

.input-area {
  margin-bottom: 30px;
}

.start-btn {
  width: 100%;
  height: 40px;
  font-size: 16px;
}

.description {
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.scene-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.scene-item {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 15px;
}

.scene-item h4 {
  margin-top: 0;
  color: #333;
}

.start-btn-sm {
  margin-top: 10px;
}
</style> 